package com.iqiyi.pps.epg.api.server.impl;

import com.iqiyi.pps.epg.api.server.iservice.ChannelApiService;
import com.iqiyi.pps.epg.api.server.proxy.ChannelProxy;
import com.iqiyi.pps.epg.api.utils.CrossDataLocalPool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by karkarrotxu on 2016/9/18.
 */
@Service("channelApiServiceImpl")
public class ChannelApiServiceImpl extends ApiServiceImpl implements ChannelApiService {

    @Autowired
    private ChannelProxy channelProxy;

    @Override
    public String createChannel(String name, String universalCode, String description, String passportId,
                                String ppsBaikeId, String liveType, String carouselTableNo, String type,
                                 String logoUrl, String maxPlaybackPeriod,
                                String tempStartTime, String tempEndTime, String qitanId, String orderBy, String isEnable,
                                String tag, String allowPopups, String shouldDisplay,
                                String isQiyiProduced, String exclusiveStatusIqiyi,
                                String interruptHintType, int sliceDelay, String subjectUrl, int automation,
                                int userCount, int cyclical, int formal, String alternatePlayCollection) {
        CrossDataLocalPool.set(getCrossData());
        // location tempName,isMemeberFree, paidStartTime,paidEndTime not use
        return channelProxy.createChannel(name, universalCode, description, passportId,
                ppsBaikeId, liveType, carouselTableNo, type,
                logoUrl, maxPlaybackPeriod,
                tempStartTime, tempEndTime, qitanId, orderBy, isEnable,
                tag, allowPopups, shouldDisplay, isQiyiProduced, exclusiveStatusIqiyi,
                interruptHintType, sliceDelay, subjectUrl, automation,
                userCount, cyclical, formal, alternatePlayCollection);
    }

    @Override
    public String editChannel(String id, String name, String universalCode,
                              String description, String passportId, String ppsBaikeId,
                              String liveType, String carouselTableNo, String type,
                               String logoUrl, String maxPlaybackPeriod,
                              String tempStartTime, String tempEndTime,
                              String qitanId, String orderBy, String isEnable,
                              String tag, String allowPopups, String shouldDisplay,
                              String isQiyiProduced, String exclusiveStatusIqiyi, String interruptHintType,
                              int sliceDelay, String subjectUrl, int userCount,
                              int cyclical, int formal, String alternatePlayCollection) {
        CrossDataLocalPool.set(getCrossData());
        // location tempName,isMemeberFree, paidStartTime,paidEndTime not use
        return channelProxy.editChannel(id, name, universalCode, description, passportId,
                ppsBaikeId, liveType, carouselTableNo, type,
                 logoUrl, maxPlaybackPeriod,
                tempStartTime, tempEndTime, qitanId, orderBy, isEnable,
                tag, allowPopups, shouldDisplay, isQiyiProduced, exclusiveStatusIqiyi,
                interruptHintType, sliceDelay, subjectUrl,
                userCount, cyclical, formal, alternatePlayCollection);
    }

    @Override
    public String getChannel(String id) {
        CrossDataLocalPool.set(getCrossData());
        return channelProxy.getChannel(id);
    }

    @Override
    public String carouselTableNo(String carouselTableNo, int type, String channelId) {
        CrossDataLocalPool.set(getCrossData());
        return channelProxy.hasCarouselTableNo(carouselTableNo, type, channelId);
    }

    @Override
    public String getChannelLogList(String channelId, Integer pageNo, Integer pageSize) {
        CrossDataLocalPool.set(getCrossData());
        return channelProxy.getChannelLogList(channelId, pageNo, pageSize);
    }

    @Override
    public String getChannelCodeList(String key) {
        CrossDataLocalPool.set(getCrossData());
        return channelProxy.getChannelCodeList(key);
    }

    @Override
    public String setPanoFormat(String channelId, String videoType, String angleX, String angleY, String zoomRate) {
        CrossDataLocalPool.set(getCrossData());
        return channelProxy.setPanoFormat(channelId, videoType, angleX, angleY, zoomRate);
    }

    @Override
    public String setThreeD(String channelId, String videoType) {
        CrossDataLocalPool.set(getCrossData());
        return channelProxy.setThreeD(channelId, videoType);
    }


    @Override
    public String delChannel(String id) {
        CrossDataLocalPool.set(getCrossData());
        return channelProxy.delChannel(id);
    }

    @Override
    public String channelList(String liveType, String type, String qipuId,
                              String name,  String startDate,
                              String endDate, String isEnable, String isDelete,
                              Integer pageNo, Integer pageSize) {
        CrossDataLocalPool.set(getCrossData());
        return channelProxy.channelList(liveType, type, qipuId,
                name,  startDate,
                endDate, isEnable, isDelete,
                 pageNo,  pageSize);
    }

    @Override
    public String channelImage(String entityId, String url, String extend, String code, String message) {
        CrossDataLocalPool.set(getCrossData());
        return channelProxy.channelImage(entityId, url, extend, code, message);
    }

    @Override
    public String chargeChannel(String qipuId, String purchaseType) {
        CrossDataLocalPool.set(getCrossData());
        return channelProxy.chargeChannel(qipuId, purchaseType);
    }

    @Override
    public String getPreviewStream(String qipuId) {
        CrossDataLocalPool.set(getCrossData());
        return channelProxy.getPreviewStream(qipuId);
    }

    @Override
    public String getPlatSettings(String channelId) {
        CrossDataLocalPool.set(getCrossData());
        return channelProxy.getPlatSettings(channelId);
    }

    @Override
    public String savePlatSettings(String channelId, String configData) {
        CrossDataLocalPool.set(getCrossData());
        return channelProxy.savePlatSettings(channelId, configData);
    }

    @Override
    public String pcaChannelFind( String categoryId,
                                 String channelId,
                               String channelName,
                               Integer pageNo,
                                 Integer pageSize){
        CrossDataLocalPool.set(getCrossData());
    return channelProxy.pcaChannelFind(categoryId, channelId,channelName,pageNo,pageSize);
}
}
